package com.tdkj.model.risevalue;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapKeyColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.springframework.core.annotation.Order;

import com.tdkj.model.base.BaseEntity;

/**
 * XnkyAdvert entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "risevalue_advert")
public class BeanAdvert extends BaseEntity implements java.io.Serializable {
	private Long pageid;//对应页面的id
	private String pagename;//对应页面名称
	private String pagecode;//对应页面编号
	private String pagetype;//对应页面类型:index,sindex,md,cl,co
	private String code;
	private String name;
	private int width;
	private int height;
	private String fileurl;//广告位文件
	
	// 竞拍中/竞拍成功使用中/到期/空
	private String status;
	private BeanAdvertType type ;
	private Map<String,String> properties;
	private List<BeanAdvertAuctionInfo> auctioninfos=new ArrayList<BeanAdvertAuctionInfo>();
	
	public BeanAdvert(){
		super();
	}
	//构造方法
	public BeanAdvert(Long pageid, String code, String name, int width,
			int height, String status) {
		super();
		this.pageid = pageid;
		this.code = code;
		this.name = name;
		this.width = width;
		this.height = height;
		this.status = status;
	}
	@Column(name = "pagename", length = 40)
	public String getPagename() {
		return pagename;
	}
	public void setPagename(String pagename) {
		this.pagename = pagename;
	}
	@Column(name = "code", length = 40)
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "pagecode", length = 40)
	public String getPagecode() {
		return pagecode;
	}
	public void setPagecode(String pagecode) {
		this.pagecode = pagecode;
	}
	@Column(name = "pagetype", length = 40)
	public String getPagetype() {
		return pagetype;
	}
	public void setPagetype(String pagetype) {
		this.pagetype = pagetype;
	}
	@Column(name = "name", length = 40)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "pageid", length = 40)
	public Long getPageid() {
		return pageid;
	}
	public void setPageid(Long pageid) {
		this.pageid = pageid;
	}
	@Column(name = "width")
	public int getWidth() {
		return width;
	}
	public void setWidth(int width) {
		this.width = width;
	}
	@Column(name = "height")
	public int getHeight() {
		return height;
	}
	public void setHeight(int height) {
		this.height = height;
	}
	@Column(name = "fileurl",length=400)
	public String getFileurl() {
		return fileurl;
	}
	public void setFileurl(String fileurl) {
		this.fileurl = fileurl;
	}
	@Column(name = "status", length = 40)
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	@ElementCollection
	@CollectionTable(name="risevalue_advert_properties",joinColumns={@JoinColumn(name="advert_id",referencedColumnName="id")})
	@MapKeyColumn(name="_key")
	@Column(name="_value")
	public Map<String, String> getProperties() {
		return properties;
	}
	/**
	 * @param positionProperties the positionProperties to set
	 */
	public void setProperties(Map<String, String> properties) {
		this.properties = properties;
	}
	/**
	 * @return the type
	 */
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="advertTypeId")
	public BeanAdvertType getType() {
		return type;
	}
	/**
	 * @param type the type to set
	 */
	public void setType(BeanAdvertType type) {
		this.type = type;
	}
	@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, mappedBy = "advert")
	public List<BeanAdvertAuctionInfo> getAuctioninfos() {
		return auctioninfos;
	}
	public void setAuctioninfos(List<BeanAdvertAuctionInfo> auctioninfos) {
		this.auctioninfos = auctioninfos;
	}
	
}